﻿
@{
    string temperatureJsonString = String.Format("[{0},{1},{2}]", Model.PhotonATemperatureViewModel.BuildJsonArray(), Model.PhotonBTemperatureViewModel.BuildJsonArray(), Model.PhotonCTemperatureViewModel.BuildJsonArray());
    string humidityJsonString = String.Format("[{0},{1},{2}]", Model.PhotonAHumidityViewModel.BuildJsonArray(), Model.PhotonBHumidityViewModel.BuildJsonArray(), Model.PhotonCHumidityViewModel.BuildJsonArray());
}

<script type="text/javascript">

    //Temperature
    temperature = JSON.parse('@Html.Raw(temperatureJsonString)');
    
    for (var i = 0; i < temperature.length; i++) {
        temperature[i] = MG.convert.date(temperature[i], 'date', "%Y-%m-%dT%H:%M:%S.%LZ");
    }

    MG.data_graphic({
        title: "Temperature",
        description: "This line chart contains multiple lines.",
        data: temperature,
        width: 1000,
        height: 300,
        target: '#Temperature',
        legend: ['Photon A','Photon B','Photon C'],
        legend_target: '.legend'
    });

    //Humidity
    humidity = JSON.parse('@Html.Raw(humidityJsonString)');

    for (var i = 0; i < humidity.length; i++) {
        humidity[i] = MG.convert.date(humidity[i], 'date', "%Y-%m-%dT%H:%M:%S.%LZ");
    }

    MG.data_graphic({
        title: "Humidity",
        description: "This line chart contains multiple lines.",
        data: humidity,
        width: 1000,
        height: 300,
        right: 40,
        target: '#Humidity',
        legend: ['Photon A', 'Photon B', 'Photon C'],
        legend_target: '.legend'
    });

</script>
    